package com.turing.post.transaction.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import com.turing.post.util.PCPSUtil;

/**
 * 商户交易记帐明细信息
 * 
 * @author ZXL
 * 
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "MCHACCDETAIL")
@IdClass(MchAccDetail.class)
public class MchAccDetail implements Serializable {
	/**
	 * 记帐流水号
	 */
	private String accSeqNo;
	/**
	 * 记帐序号
	 */
	private Integer accSubSeqNo;
	/**
	 * 商户号
	 */
	private String merchantNo;
	/**
	 * 交易日期
	 */
	private Date tranDate;
	/**
	 * 主流水号
	 */
	private String tranSeqNo;
	/**
	 * 卡号
	 */
	private String cardNo;
	/**
	 * 主帐号
	 */
	private BigInteger masterAccNo;
	/**
	 * 子帐号
	 */
	private BigInteger subAccNo;
	/**
	 * 开户机构号
	 */
	private String openBranchNo;
	/**
	 * 销售员组ID
	 */
	private BigInteger salesGroupId;
	/**
	 * 消费发生额
	 */
	private BigInteger paidAmount;
	/**
	 * 充值发生额
	 */
	private BigInteger depositAmount;
	/**
	 * 手续费发生额
	 */
	private BigInteger feeAmount;

	public MchAccDetail() {
		super();
	}

	@Id
	@Column(name = "ACCSEQNO", nullable = false)
	public String getAccSeqNo() {
		return accSeqNo;
	}

	public void setAccSeqNo(String accSeqNo) {
		this.accSeqNo = accSeqNo;
	}

	@Id
	@Column(name = "ACCSUBSEQNO", nullable = false)
	public Integer getAccSubSeqNo() {
		return accSubSeqNo;
	}

	public void setAccSubSeqNo(Integer accSubSeqNo) {
		this.accSubSeqNo = accSubSeqNo;
	}

	@Column(name = "MERCHANTNO", nullable = false)
	public String getMerchantNo() {
		return merchantNo;
	}

	public void setMerchantNo(String merchantNo) {
		this.merchantNo = merchantNo;
	}

	@Column(name = "TRANDATE", nullable = false)
	public Date getTranDate() {
		return tranDate;
	}

	public void setTranDate(Date tranDate) {
		this.tranDate = tranDate;
	}

	@Column(name = "TRANSEQNO", nullable = false)
	public String getTranSeqNo() {
		return tranSeqNo;
	}

	public void setTranSeqNo(String tranSeqNo) {
		this.tranSeqNo = tranSeqNo;
	}

	@Column(name = "CARDNO", nullable = true)
	public String getCardNo() {
		return cardNo;
	}

	public void setCardNo(String cardNo) {
		this.cardNo = cardNo;
	}

	@Column(name = "MASTERACCNO", nullable = false)
	public BigInteger getMasterAccNo() {
		return masterAccNo;
	}

	public void setMasterAccNo(BigInteger masterAccNo) {
		this.masterAccNo = masterAccNo;
	}

	@Column(name = "SUBACCNO", nullable = false)
	public BigInteger getSubAccNo() {
		return subAccNo;
	}

	public void setSubAccNo(BigInteger subAccNo) {
		this.subAccNo = subAccNo;
	}

	@Column(name = "OPENBRANCHNO", nullable = false)
	public String getOpenBranchNo() {
		return openBranchNo;
	}

	public void setOpenBranchNo(String openBranchNo) {
		this.openBranchNo = openBranchNo;
	}

	@Column(name = "SALESGROUPID", nullable = true)
	public BigInteger getSalesGroupId() {
		return salesGroupId;
	}

	public void setSalesGroupId(BigInteger salesGroupId) {
		this.salesGroupId = salesGroupId;
	}

	@Column(name = "PAIDAMOUNT", nullable = false)
	public BigInteger getPaidAmount() {
		return paidAmount;
	}

	public void setPaidAmount(BigInteger paidAmount) {
		this.paidAmount = paidAmount;
	}

	@Column(name = "DEPOSITAMOUNT", nullable = false)
	public BigInteger getDepositAmount() {
		return depositAmount;
	}

	public void setDepositAmount(BigInteger depositAmount) {
		this.depositAmount = depositAmount;
	}

	@Column(name = "FEEAMOUNT", nullable = false)
	public BigInteger getFeeAmount() {
		return feeAmount;
	}

	public void setFeeAmount(BigInteger feeAmount) {
		this.feeAmount = feeAmount;
	}

	@Override
	public int hashCode() {
		return PCPSUtil.getObjectListHashCode(new Object[] { getAccSeqNo(),
				getAccSubSeqNo() });
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof MchAccDetail))
			return false;
		MchAccDetail other = (MchAccDetail) obj;
		if (!PCPSUtil.compareObject(this.getAccSeqNo(), other.getAccSeqNo()))
			return false;

		return PCPSUtil.compareObject(this.getAccSubSeqNo(), other
				.getAccSubSeqNo());
	}
}